package com.example.demo.mapper.sysdict;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.bean.PageRes;
import com.example.demo.bean.sysdict.SysDictDataDO;
import com.example.demo.mapper.BaseMapperX;
import com.example.demo.dto.sysdict.SysDictDataPageReqVO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SysDictDataMapper extends BaseMapperX<SysDictDataDO> {
    default PageRes<SysDictDataDO> selectPage(SysDictDataPageReqVO reqVO) {
        Page<SysDictDataDO> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
        return selectPageCommon(page, new QueryWrapper<SysDictDataDO>()
                .like(ObjectUtil.isNotNull(reqVO.getDictDataName()), "dict_data_name", reqVO.getDictDataName())
                .like(ObjectUtil.isNotNull(reqVO.getDictDataValue()), "dict_data_value", reqVO.getDictDataValue())
                .like(ObjectUtil.isNotNull(reqVO.getDictCode()),"dict_type",reqVO.getDictCode()));
    }
}
